{!! Html::style(env("APP_URL").'/assets/backend/libs/webuploader-0.1.5/webuploader.css') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/Tagator/fm.tagator.jquery.css') !!}
{!! Html::script(env("APP_URL").'/assets/backend/libs/md5.js') !!}
{!! Html::style(env("APP_URL").'/assets/backend/libs/jquery.el/spec/base.css') !!}
<style type="text/css">
    .filelist {
        clear: both;
        width: 100%;
        float: left;
        padding-bottom: 20px;
    }

    .filelist li {
        list-style: none;
        text-align: center;
        margin-right: 12px;
        float: left;
        width: 103px;
        height: 103px
    }

    .filelist li img {
        width: 100px;
        height: 100px
    }

    .filelist .current {
        border: 3px #f60 solid;
    }

    #sku-builder .color-block {
        display: inline-block;
        width: 12px;
        height: 12px;
        border: 1px solid #cccccc;
        border-radius: 2px;
        margin-right: 3px;
    }

    #sku-table input[type=file] {
        display: inline-block;
        margin-top: 10px;
    }

    #sku-table th {
        min-width: 90px
    }

    #sku-table th.sku-th {
        min-width: 170px
    }

    #sku-table input {
        width: 100%
    }

    .readonly_back {
        background-color: #eee;
        opacity: 1;
    }
</style>


<div class="nav-tabs-custom tabs-container">
    <ul class="nav nav-tabs">
        <li class="active"><a href="#tab_1" data-toggle="tab" aria-expanded="true">商品信息</a></li>
    </ul>
    {!! Form::open( [ 'url' => [route('admin.shop.goods.saveGoods')], 'method' => 'POST', 'id' => 'base-form','class'=>'form-horizontal'] ) !!}
    <div class="tab-content">
        <div class="tab-pane active" id="tab_1">
            <div class="panel-body">
                <input type="hidden" name="id" value="{{$goods->id}}">
                <input type="hidden" name="shop_id" value="{{ $goods->shop_id }}">
                <input type="hidden" name="goods_id" value="{{ $goods->goods_id }}">
                <div class="form-group">
                    <label class="col-sm-2 control-label">商品名称：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="name" placeholder="" value="{{$goods_info->name}}"
                               readonly>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 control-label">商品数量：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="store_nums" id="total_store_nums" placeholder=""
                               value="{{$goods->store_nums}}" readonly>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">特价商品：</label>
                    <div class="col-sm-10">
                        <input name="is_discount" type="radio" value="1" {{$goods->is_discount?'checked':''}} /> 是
                        <input name="is_discount" type="radio" value="0" {{$goods->is_discount?'':'checked'}} /> 否
                    </div>
                </div>


                <div class="form-group" id="discount_box" style="display: {{$goods->is_discount?'':'none'}}">
                    <label class="col-sm-2 control-label">特价：</label>
                    <div class="col-sm-10">
                        <input type="text" class="form-control" name="discount_price" placeholder=""
                               value="{{$goods->discount_price}}">
                    </div>
                </div>


                <div class="form-group">
                    <label class="col-sm-2 control-label">是否可使用积分抵扣：</label>
                    <div class="col-sm-10">
                        <input name="point_deduction" type="radio" value="1" {{$goods->point_deduction?'checked':''}} />
                        是
                        <input name="point_deduction" type="radio" value="0" {{$goods->point_deduction?'':'checked'}} />
                        否
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 control-label">是否可获得积分：</label>
                    <div class="col-sm-10">
                        <input name="can_get_point" type="radio" value="1" {{$goods->can_get_point?'checked':''}} />
                        是
                        <input name="can_get_point" type="radio" value="0" {{$goods->can_get_point?'':'checked'}} />
                        否
                    </div>
                </div>



                <script type="text/html" id="template-spec">
                    <div class="col-sm-4 col-md-3 col-lg-3">
                        <label>
                            <input type="checkbox" value="{#id#}" name="spec_id_{#sid#}[]" data-uuid="{#sid#}-{#id#}"
                                   icheck-name="spec_{#sid#}_{#id#}" {#checked#}>
                            {#block#}
                        </label>
                        {#textInput#}
                    </div>
                </script>
                <script type="text/html" id="template-sku-tr">
                    <td><input type="text" class="readonly_back" data-name="market_price" data-action="save"
                               value="{#market_price#}" name="_spec[{#index#}][market_price]" readonly>
                    </td>
                    <td>
                        <input type="hidden" data-name="id" data-action="save" value="{#id#}"
                               name="_spec[{#index#}][id]">
                        <input type="hidden" data-name="specID" data-action="save" value="{#spec#}"
                               name="_spec[{#index#}][specID]">
                        <input type="text" class="readonly_back" data-name="sell_price" data-action="save"
                               value="{#sell_price#}" name="_spec[{#index#}][sell_price]" readonly></td>
                    <td><input type="text" class="readonly_back" data-name="store_nums" data-action="save"
                               value="{#store_nums#}" name="_spec[{#index#}][store_nums]" readonly></td>
                    <td><input type="text" class="readonly_back" data-name="sku" data-action="save" value="{#sku#}"
                               name="_spec[{#index#}][sku]" readonly></td>
                </script>
                <script type="text/html" id="template-img-table">
                    </script>
                <script type="text/html" id="template-img-tr">
                    <tr data-id="{#id#}" data-sid="{#sid#}">
                        <td>
                            {#block#}
                        </td>
                        <td>
                            <input type="text" data-id="{#id#}" data-sid="{#sid#}" data-action="update"
                                   value="{#alias#}" name="spec_alias[{#id#}]"/>
                        </td>
                        <td class="image">
                            <div class="block{#class#}">{#imgTag#}</div>
                            <label class="block img-plus">
                                <span class="glyphicon glyphicon-plus"></span>
                                <input type="file" name="upload_image" accept="image/*">
                            </label>
                        </td>
                    </tr>
                </script>
                <div id="sku-builder">
                    <div id="module-specs">
                    </div>

                    <div class="form-group">
                        <label class="col-sm-2 control-label">产品列表：</label>
                        <div class="col-sm-10">
                            <table class="table table-bordered" id="sku-table">
                                <thead>
                                <tr>
                                    <!--规格-->
                                    <th>颜色图片</th>
                                    <th>吊牌价</th>
                                    <th>零售价</th>
                                    <th>数量</th>
                                    <th class="sku-th">SKU</th>
                                </tr>
                                </thead>
                                <tbody>
                                <!--数据列表-->
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="ibox-content m-b-sm border-bottom text-right">
            <input type="submit" class="btn btn-success" value="保存">
        </div>
        {!! Form::close() !!}
    </div>

    <div class="popup">
        <div class="sortContainer">
            <h2 class="sortTitle">销售属性排序</h2>
            <p>销售属性支持排序，您可以直接通过拖拽调节顺序</p>
            <div class="sortMain">
                <ul id="sort">

                </ul>
            </div>

            <div class="btn-box">
                <button class="btn btn-cancle sortCancle pull-right">取消</button>
                <button class="btn btn-success sortOK pull-right">确认</button>
            </div>
        </div>
    </div>
    {!! Html::script(env("APP_URL").'/assets/backend/libs/jquery.form.min.js') !!}


    @include('shop-backend::goods.script')
    <script>
        $("input[name='is_discount']").on('ifClicked', function () {
            var discount_box = $('#discount_box');
            if ($(this).val() == 1) {
                discount_box.show();
            } else {
                discount_box.hide();
            }
        });
    </script>